package com.boc.ewr.util.file.enumeration;

import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.collection.SetUtils;

import java.util.Arrays;
import java.util.Optional;
import java.util.Set;

/**
 * @author : Wzz
 * @create : 2023-06- 27- 14:19
 * @desc : 账单状态 枚举
 */


@Slf4j
public enum BillStatusEnum {

    ON_TIME("外包按期回收", "01"),
    NO_ON_TIME("外包逾期回收", "02"),

    PACKED("打包发送", "03"),

    OUTSRC_LOST("外包遗失", "04"),
    FAKE("虚假退信", "05"),
    COMPLAIN("客户投诉", "06"),
    CUSM_LOST("客户遗失", "07"),
    CUSM_UNRECEIVE("客户拒收", "08"),
    CUSM_UNSEND("客户拒交", "09"),

    UNRETURN("未回", "10"),

    OUTSRC_BACK("外包退信", "11"),

    CUSM_SELF("客户自寄", "12");


    private String index;
    private String value;

    BillStatusEnum(String value, String index) {

        this.index = index;
        this.value = value;
    }

    /**
     * 根据value获取枚举对象
     *
     * @param val
     * @return
     */
    public static BillStatusEnum getIndexByValue(String val) {
        Optional<BillStatusEnum> first = Arrays.stream(BillStatusEnum.values()).filter(e -> e.getValue().equals(val)).findFirst();
        BillStatusEnum expEnum = first.orElse(null);
        log.info("选择的枚举类型是：" + expEnum.toString());
        return expEnum;
    }

    /*外包逾期回收
      未回收
      外包遗失
      虚假退信
      客户投诉
      */
    public static Set<String> getDefaultIndexSet() {
        return SetUtils.asSet(
                NO_ON_TIME.getIndex(),
                UNRETURN.getIndex(),
                OUTSRC_LOST.getIndex(),
                FAKE.getIndex(),
                COMPLAIN.getIndex()
        );
    }

    public String getIndex() {
        return index;
    }

    public void setIndex(String index) {
        this.index = index;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
